const HOSPITTAL_NAME = '江苏省中医院'

const header = {
  state: {
    title: HOSPITTAL_NAME,
    leftButton: true,
    rightButton: false,
    rightHtml: '注册',
    rightClick: function () {},
    style: {},
    show: true
  },
  mutations: {
    UPDATE_TITLE (state, title) {
      if (!title) title = HOSPITTAL_NAME
      state.title = title
    },
    UPDATE_LEFTBUTTON (state, show) {
      state.leftButton = show
    },
    UPDATE_RIGHTBUTTON (state, payload) {
      state.rightButton = payload.show
      state.rightHtml = payload.html || '注册'
      state.rightClick = payload.fn || function () {}
    },
    UPDATE_STYLE (state, style) {
      state.style = style
    },
    UPDATE_HEADERSHOW (state, show) {
      if (show === undefined) {
        state.show = !state.show
      } else {
        state.show = show
      }
    }
  }
}

export default header
